package com.transaction.manage.localMapper;

import com.transaction.manage.model.dto.FundInfo;
import com.transaction.manage.model.vo.ComboboxVo;
import com.transaction.manage.myMapper.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface FundInfoMapper extends MyMapper<FundInfo> {

    @Update("UPDATE fund_info SET valid_flag = '00' ,check_flag = '00' WHERE channel_code = #{channelCode} AND fund_code = #{fundCode}")
    void deleteFundInfo(@Param("channelCode") String channelCode, @Param("fundCode") String fundCode);

    @Update("UPDATE fund_info SET check_flag = '01' WHERE channel_code = #{channelCode} AND fund_code = #{fundCode}")
    void checkFundInfo(@Param("channelCode") String channelCode,@Param("fundCode") String fundCode);

    List<FundInfo> selectFundInfoList(FundInfo fundInfo);

    void insertFundInfo(FundInfo fundInfo);

    void updateFundInfo(FundInfo fundInfo);

    List<ComboboxVo> selectValidFundInfoCombobox(@Param("channelCode") String channelCode);

    void updateFundInfoByChannelAndFundCode(FundInfo fundInfo);

    FundInfo selectFundInfoByChannelAndFundCode(@Param("channelCode") String channelCode,@Param("fundCode") String fundCode);

    List<ComboboxVo> selectTransRateFundInfoCombobox(@Param("channelCode") String channelCode);

    List<ComboboxVo> selectOpenFundInfoCombobox(@Param("channelCode") String channelCode);

    @Update("UPDATE fund_info SET status_flag = 0 WHERE channel_code = #{channelCode} AND DATEDIFF(#{handleDate}, maturity_date) > 30")
    int stopExpireFund(@Param("channelCode") String channelCode, @Param("handleDate") String handleDate);


    List<FundInfo> selectValidFundInfo(@Param("channelCode") String channelCode);

}